package com.intct.hbase.ddl.service;

import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionFactory;

import java.io.IOException;

/**
 * @author gufg
 * @since 2025-08-05 10:26
 */
public abstract class AbstaractHBaseDDL {
    public void start() throws IOException {
        // 1 创建HBase连接
        Connection connection = ConnectionFactory.createConnection();

        // 2 获取admin实例
        Admin admin = connection.getAdmin();

        // 3 业务逻辑
        execCommand(admin);

        // 4 关闭连接
        admin.close();
        connection.close();
    }

    public abstract void execCommand(Admin admin);
}
